﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Net5ApiAndEfMySql.DtoModel;
using Net5ApiAndEfMySql.IRepository.SystemAdmin;
using Net5ApiAndEfMySql.IService.SystemAdmin;
using Net5ApiAndEfMySql.PoModel.SystemAdmin;

namespace Net5ApiAndEfMySql.Service.SystemAdmin
{
    public class RoleDbService : BaseService, IRoleDbService
    {
        private IRoleDbRepository _iRoleDbRepository;
      
        public RoleDbService(IRoleDbRepository iRoleDbRepository)
        {
            _iRoleDbRepository = iRoleDbRepository;
        }
        /// <summary>
        /// 角色的分页查询
        /// </summary>
        /// <param name="m"></param>
        /// <returns></returns>
        public PagerResult<RoleDbPo> GetPageList(SearchModel m)
        {
            return _iRoleDbRepository.GetPageList(m);
        }

        /// <summary>
        /// 角色的添加
        /// </summary>
        /// <param name="role"></param>
        /// <returns></returns>
        public bool AddRole(RoleDbPo role)
        {
            role.role_createtime = DateTime.Now;
            return _iRoleDbRepository.AddRole(role);
        }
        /// <summary>
        /// 反填操作
        /// </summary>
        /// <param name="role_id"></param>
        /// <returns></returns>
        public RoleDbPo GetRoleById(int role_id)
        {
            return _iRoleDbRepository.GetRoleById(role_id);
        }

        /// <summary>
        /// 修改角色表
        /// </summary>
        /// <param name="but"></param>
        /// <returns></returns>
        public bool UpdateRoleDbPo(RoleDbPo role)
        {
            role.role_createtime = DateTime.Now;
            return _iRoleDbRepository.UpdateRoleDbPo(role);
        }

        /// <summary>
        /// 删除角色表
        /// </summary>
        /// <param name="role_id"></param>
        /// <returns></returns>
        public bool DeleteRoleDbPo(int role_id)
        {
            return _iRoleDbRepository.DeleteRoleDbPo(role_id);
        }



    }
}
